package com.shujia.wyh.day14.factorydemo1;

/*
    动物工厂：负责创建动物
 */
public class AnimalFactory {
    private AnimalFactory(){}

    public static Animal getAnimal(String s){
        if("dog".equals(s)){
            return new Dog();
        }else if("cat".equals(s)){
            return new Cat();
        }else {
            System.out.println("该工厂还不支持创建");
            return null;
        }
    }
}
